home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10078 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: news.lpr.carel.fi!usenet
  2. From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Boot Disk!
  5. Date: Fri, 15 Mar 1996 15:34:54 +0200
  6. Organization: Carelcomp Products
  7. Message-ID: <314971FE.7F9F@cmt.lpr.mail.carel.fi>
  8. References: <3144FC6B.179B@plink.cityu.edu.hk> <826591925snz@genesis.demon.co.uk> <3145A931.1ACC@oc.com>
  9. NNTP-Posting-Host: renoir.cclahti.carel.fi
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. In article <3144FC6B.179B@plink.cityu.edu.hk>
  16.            95471004@plink.cityu.edu.hk "Jonathan Chiu Chi Hang" writes:
  17. >        Does anyone know how to write a program in C to make a disk that
  18. >redirect the boot drive from drive A to drive B when boot time.  What is
  19. >the algoithm?  Or provide the source code for reference.
  20.  
  21. One solution (if you really want to do it) is this. Write a bootstrap loader and install 
  22. it on disk (to be used in drive A) track 0, head 0, sector 1. When the computer is booted, 
  23. the sector is read into memory starting at location 7C00hex by the BIOS and the control is 
  24. passed to the beginning of this code.
  25.  
  26. Now, the code should relocate itself, say, 512 bytes higher in memory and jump at a 
  27. predefined location in it (you must take this into account using offset offsets, when 
  28. you're writing this code, so it would be easiest to do it all in assembly). From that 
  29. location on, there would reside code that read the boot sector from a disk in drive B into 
  30. the same (7C00) location and jumping to the start of it. Be sure your segment registers, 
  31. DL (as I recall, it contains the boot drive code) and stack are set correctly. I admit, 
  32. this is not so trivial as it might seem, but it has been and can be done. One last word: 
  33. remember to check that the disks are actually bootable.
  34.  
  35. Later,
  36.  AriL
  37. -- 
  38. All my opinions are mine and mine alone.
  39.